package com.itheima2;

import java.util.HashMap;

public class Work5 {
    public static void main(String[] args) {
        String s ="wo ai heima wo ai java wo yao hao hao xue xi java";
        String[] s1 = s.split(" ");
        HashMap<String,Integer> map =new HashMap<>();
        for (String s2 : s1) {
            map.put(s2,map.containsKey(s2)?map.get(s2)+1:1);
        }
        map.forEach((k,v)-> System.out.println(k+"("+v+")"));
    }
}
